<?php

/**
 * @author ducnhat
 * @email ddnhat@gmail.com
 * @copyright 2014
 */
 
class Admin_PluginController extends Zenddn_Controller_Action{
	
	public function init(){
		parent::init();
        parent::loadTemplate('alpona');
        $this->view->headTitle = "Plugin";
        $this->_helper->viewRenderer->setNoRender();
        echo "<br />" . __METHOD__;
	}
	
	public function indexAction(){
		$upload = new Zend_File_Transfer_Adapter_Http();
        //$upload->setDestination(UPLOAD_PATH . "/avatar");
        //$option = array('jpg', 'jpeg', 'png', 'bmp', 'gif');
        //$upload->addValidator('Extension', false, $option);
        //$upload->addValidator('Size', false, array('max' => '100KB'));
        
        if($upload->isValid()){
            $info = $upload->getFileName();
            $ext = explode('.', $info);
            $ext = end($ext);
            
            $option = array('target' => UPLOAD_PATH . '/avatar/avatar_2.' . $ext);
            $upload->addFilter('Rename', $option);
            $upload->receive();
        }else{
            echo current($upload->getMessages());
        }
	}
    
    public function createAction(){
    	
    }
    
    public function editAction(){
        
    }
    
    public function deleteAction(){
        
    }
}